]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
FdoNotifications: Only set the title of a Source once
authorJulian Sparber <julian@sparber.net>
Thu, 25 Jan 2024 20:11:50 +0000 (21:11 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 30 Jan 2024 17:05:23 +0000 (17:05 +0000)
Even though the comment in the code says that sources are reused even
thought the app title has changed this is actually not the case. Therefore
when ever the app title of a notification changes a new `Source` is
created. Therefore there is no point in setting the app title again.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3103>

js/ui/notificationDaemon.js

index 4e338bbe7c40e5aed501611a3afcaff935a55105..23d44458c1375016419787958dd419cb3887d3d6 100644 (file)
@@ -101,10 +101,8 @@ class FdoNotificationDaemon {
             return ndata.notification.source;
 
         let source = this._lookupSource(title, pid);
-        if (source) {
-            source.setTitle(title);
+        if (source)
             return source;
-        }
 
         const appId = ndata?.hints['desktop-entry'];
         source = new FdoNotificationDaemonSource(title, pid, sender, appId);
@@ -312,10 +310,9 @@ class FdoNotificationDaemonSource extends MessageTray.Source {
         this.initialTitle = title;
         this.app = this._getApp(appId);
 
-        super._init(title);
-
-        if (this.app)
-            this.title = this.app.get_name();
+        // Use app name as title if available, instead of whatever is provided
+        // through libnotify (usually garbage)
+        super._init(this.app ? this.app.get_name() : title);
 
         if (sender) {
             this._nameWatcherId = Gio.DBus.session.watch_name(sender,
@@ -376,16 +373,6 @@ class FdoNotificationDaemonSource extends MessageTray.Source {
         return app;
     }
 
-    setTitle(title) {
-        // Do nothing if .app is set, we don't want to override the
-        // app name with whatever is provided through libnotify (usually
-        // garbage)
-        if (this.app)
-            return;
-
-        super.setTitle(title);
-    }
-
     open() {
         this.openApp();
         this.destroyNonResidentNotifications();